package net.esj.basic.utils.clone;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

public abstract class CloneEntity implements Cloneable {
	
	
	@Override
	protected Object clone() throws CloneNotSupportedException {
		ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
		ObjectWriteorRead.writeObject(this, byteOut);
		ByteArrayInputStream bytein = new ByteArrayInputStream(byteOut.toByteArray());
		Object newEntity = ObjectWriteorRead.readObject(bytein);
		return newEntity;
	}

	
}
